﻿using System;
using System.Collections;
using UnityEngine;

// Token: 0x020002A2 RID: 674
public abstract class SMGProjectile : Projectile
{
	// Token: 0x06000F18 RID: 3864 RVA: 0x00073710 File Offset: 0x00071910
	protected override void Start()
	{
		base.Start();
		this.trail.startWidth *= base.transform.localScale.x;
		this.trail.endWidth *= base.transform.localScale.x;
		this.trail.time *= base.transform.localScale.x;
	}

	// Token: 0x06000F19 RID: 3865 RVA: 0x00073794 File Offset: 0x00071994
	private void Update()
	{
		if (!this.alive)
		{
			return;
		}
		base.transform.position += base.transform.forward * this.baseSpeed * Time.deltaTime;
		this.lifeTime -= Time.deltaTime;
		if (this.lifeTime < 0f)
		{
			UnityEngine.Object.Destroy(base.gameObject);
		}
	}

	// Token: 0x06000F1A RID: 3866 RVA: 0x00073810 File Offset: 0x00071A10
	protected override void Impact(GameObject hitObject)
	{
		this.alive = false;
		this.audioSource.Play();
		IEnumerator enumerator = base.gameObject.transform.GetEnumerator();
		try
		{
			while (enumerator.MoveNext())
			{
				object obj = enumerator.Current;
				Transform transform = (Transform)obj;
				UnityEngine.Object.Destroy(transform.gameObject);
			}
		}
		finally
		{
			IDisposable disposable;
			if ((disposable = (enumerator as IDisposable)) != null)
			{
				disposable.Dispose();
			}
		}
		base.gameObject.GetComponent<CapsuleCollider>().enabled = false;
		base.gameObject.GetComponent<Rigidbody>().detectCollisions = false;
		this.projectileModelRenderer.enabled = false;
		UnityEngine.Object.Destroy(base.gameObject, 3f);
	}

	// Token: 0x06000F1B RID: 3867 RVA: 0x000738D0 File Offset: 0x00071AD0
	protected override void SetColor(Color color, float emissionModifier = 1f)
	{
		this.mainColor = color;
		Vector4 v = new Vector4(color.r, color.g, color.b, 0f) * (Mathf.Log(Mathf.Abs(emissionModifier) + 1.3f, 2.3f) * 2f);
		Material material = this.projectileModelRenderer.material;
		material.color = color;
		Material material2 = this.trail.material;
		material2.SetColor("_Color", color);
		material2.SetColor("_EmissionColor", v);
	}

	// Token: 0x0400140C RID: 5132
	[SerializeField]
	private TrailRenderer trail;

	// Token: 0x0400140D RID: 5133
	[SerializeField]
	private Renderer projectileModelRenderer;
}
